home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_bas / basupd10 / year.bas < prev   
BASIC Source File  |  1992-06-17  |  974b  |  27 lines

  1. '   +----------------------------------------------------------------------+
  2. '   |                                                                      |
  3. '   |           BasUpd  Copyright (c) 1992  Thomas G. Hanlin III           |
  4. '   |                                                                      |
  5. '   |            See BASUPD.DOC for info on distribution policy            |
  6. '   |                                                                      |
  7. '   +----------------------------------------------------------------------+
  8.  
  9.    DEFINT A-Z
  10.  
  11. FUNCTION Year (SerialNr#)
  12.    TDate& = CLNG(SerialNr#) + 53688
  13.    YearNr = 1753
  14.    DO WHILE TDate& >= 365&
  15.       IF YearNr MOD 4 = 0 AND YearNr MOD 100 > 0 OR YearNr MOD 400 = 0 THEN
  16.          TDate& = TDate& - 366&
  17.       ELSE
  18.          TDate& = TDate& - 365&
  19.       END IF
  20.       YearNr = YearNr + 1
  21.    LOOP
  22.    IF TDate& < 0& THEN
  23.       YearNr = YearNr - 1
  24.    END IF
  25.    Year = YearNr
  26. END FUNCTION
  27.